#ifndef writer_h
#define writer_h



#include "itkImage.h"
#include "itkImageFileWriter.h"
#include <itkSpatialObjectWriter.h>

namespace FPTK{



template<class PixelType,unsigned int Dimension>
class writer
{
   public:
      typedef itk::Image< PixelType,Dimension>   ImageType;
      typedef itk::ImageFileWriter< ImageType >  WriterTypeImage;
      typedef itk::SpatialObjectWriter<Dimension> WriterTypeSO;
      typedef itk::BlobSpatialObject<Dimension> BlobType;
      typedef itk::SpatialObjectPoint<Dimension> BlobPointType;
	  typedef typename ImageType::Pointer ImageTypePointer;
	  typedef typename BlobType::Pointer BlobTypePointer;
      typedef typename WriterTypeSO::Pointer WriterTypeSOPointer;
	  typedef typename WriterTypeImage::Pointer WriterTypeImagePointer;
	  writer();
      ~writer();
      int SetInputImage(ImageTypePointer image);
      int SetInputSpatialObject(BlobTypePointer blob_image);
      int SetName(char* _filename,char *_add);
      int SetExtension(char *_extension);
      int Update();
      char* GetName();
      void Setostream(std::ostream *_out) {out=_out;}
   private:
      int CreateName();
      std::ostream *out;
      char* name,*extension,*add,*filename;
      WriterTypeSOPointer writer_so;
      WriterTypeImagePointer writer_image;
};
}//end of FPTK namespace

#include "Writer.cxx"

#endif